<?php
/*
+------------------------------------------------------------------------------+
|   Rooster - a plugin by Francis Cheung
|
|	Plugin Support Site: e107.webstartinternet.com
|
|	For the e107 website system visit http://e107.org
|
|	Released under the terms and conditions of the
|	GNU General Public License (http://gnu.org).
+------------------------------------------------------------------------------+
*/
require_once('../../class2.php');
require_once('roster_class.php');
if (!defined('e107_INIT')) { exit(); }
include_lan(e_PLUGIN.'roster/languages/'.e_LANGUAGE.'.php');

// +++++++++++++++E107 UPDATABLE VARIABLES BELOW:
// Stop caching for all browsers
session_cache_limiter('nocache');
// Start a session to catch the image list
session_start();
// Render the value of $text in a table.

// Get all the date for the next 3 month's sundays
$arr_Sunday=getDateForSpecificDayBetweenDates($_GET['selected_date'], 0, 12);

$title = RS_CORE_00;
$text ="<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">
<head>
<meta http-equiv='content-type' content='text/html; charset=utf-8' />
<meta http-equiv='content-style-type' content='text/css' />
<meta http-equiv='content-language' content='en' />
<title>e107 Powered Website</title>
";
$text .= "<input type='button' value='Print this page' onclick=\"window.print();return false;\" />";
$text .= "<input type='button' value='Close' onclick=\"window.close();return false;\" />";
$text .= "<table border='1'><tr>";
$text .= "<td>日期</td><td>擘餅</td><td>協助擘餅</td><td>主席</td><td>主席傳譯</td><td>講道</td><td>傳譯</td><td>司琴</td><td>風琴</td><td>司事</td><td>當值執事</td></tr>";

foreach ($arr_Sunday as $key=>$value)
{
	$str_curr_date=$value;
	$text .= "<tr>";
	$text .= "<td>".$value."</td>";
	$text .= "<td>".getUserNameForJob($sql, 1, $str_curr_date)."</td>";

	$text .= "<td>".getUserNameForJob($sql, 3, $str_curr_date)."</p>".getUserNameForJob($sql, 13, $str_curr_date)."</p>".getUserNameForJob($sql, 14, $str_curr_date)."</td>";

	$text .= "<td>".getUserNameForJob($sql, 6, $str_curr_date)."</td>";

	$text .= "<td>".getUserNameForJob($sql, 7, $str_curr_date)."</td>";

	$text .= "<td>".getUserNameForJob($sql, 4, $str_curr_date)."</td>";
	
	$text .= "<td>".getUserNameForJob($sql, 5, $str_curr_date)."</td>";
	
	$text .= "<td>".getUserNameForJob($sql, 12, $str_curr_date)."</td>";

	$text .= "<td>".getUserNameForJob($sql, 8, $str_curr_date)."</td>";
	$text .= "<td>".getUserNameForJob($sql, 11, $str_curr_date)."</td>";
	
	$text .= "<td>".getUserNameForJob($sql, 10, $str_curr_date)."</td>";
	$text .= "</tr>";
}

$ns -> tablerender($title, $text);

?>
